Makes beep on error work correctly