Fixed a potential iterator bug in compression