Xk8 coupe 1996 start car,starts but will not rev.take off battery lead will rev

xk8 coupe 1996 start car,starts but will not rev.take off battery lead,replace it,will rev but rough and fast tick over 2000 rpm.when warm does not tick over at 600 rpm,help
richard