Fixes a bug in character movement