fix the reset function