fix typo bug and slightly refactor move function