Fixed various issues after the refactor