fixed some mistakes
code is strongly needed in refactoring