fix map load bug, refactor