I made some changes:
Bullet angle is unreliable, so I added BallAngle instance variable and changing it with events.
Bullet angle of motion is set to BallAngle on every tick. "Bounce off solids" is now disabled.
Thank you so much for your help, it's working perfectly now.
However if I clicked the mouse at the same time the ball hits one of the vertical walls the ball would go through that wall or it would bounce back to the same way it came from.
Do you think you can fix this?