Fix bugs in the new OpenSearchLayer