Small fix to compress function