fixed bad error in code not caught by tests