bug fixing of the reset function