[fix] fix bug and continue refactoring