simplified implementation to use same dictionary update algorithm on both
compression and decompression; seems to be bug free now