Bugfix for movement calculation