fix bug from refactor