Fix bug in CanMove function.