fix the compress() function