fixing small bugs with reset queue in algorithm