fix vector bugs by using Math.atan2