Teleport Fail ?

Can anyone explain this strange behavior ? In this ‘ball in grid’ display the sprite stays within the grid square if it is in the middle squares but when moving to an outer square it is teleported to a grid line and there it stays. Very simple code. How can I keep the ball in square centers all over the grid , not just the center ? Thanks: