More error handling to prevent unpredicted timeouts