modified compression and decompression functions to fix errors