fix bug
fix bug and refactoring