fixed getSnakeLength(), added out of bounds function and a check for it in update