Fixed issues in refactor.