Fixed code in reset function which caused DOM exception