fixing errors in refactor