Fixed bug in calculating the relative mouse position