several fixes related to file download call. Added support for gzipped downloads