preserve original file format if possible. Fixes #247