fix for https://github.com/elasticsearch/elasticsearch/issues/3673