refactoring, fix small errors