correctly sending max and error data to the server
earlier, because of not closing things got messed up