Prevent setting headers after they are sent