Fixed a major bug. It did not calculate correctly the collision with the wall.