fixed some bugs based on sideline refactoring