Fix reset function