Bugfix in the reset function