fix compression with some extra changes