Fixed a bug in reset