Modify onGround() function