fixing bug from refactor