prevent error messages from showing on page unload