Movement fixes

Fix three major movement-related bugs. See the commits for more info.