OK George, looks you you were right again.
I did a 68x68 terrain and paid attention to filling in the right value for the var and it works perfectly every time now.
Thanks for pointing it out.