fixed reset function