fix bug & compress function