Error events and empty response handling added