Fixed some issues after refactor