fix compress logic