Made things a bit more robust (check for empty response in indexing).