Fix problems in handling pes files