Added logging and null request error handling