Fixed stuff due to refactoring