fix a critical bug for resetting