add better handling for compressed files