fixed a bug and refactoring