fix the move command logic