before refactoring.
Fixed some resolving bugs.