handle gzipped streams, use a more specific regex to find the key order