fix bugs from refactor and reset