Fixed some bug due to refactoring