Fixed issues caused by refactoring