Fixed some issues after refactoring.