Okay, as suggested by Supercool789, I fixed the glitch where the ball sticks to the sides by adding a thin border, which repels the ball when touched.