fix reset function