fix bug in compressing