Fixed reset errors and validation function.