Fix compress function