Correctly detecting empty and nil values for generate_index_hash.