fixing bug caused by refactor