added handling of empty response