Fixed error in gap propagation with partitions

Fixed error that caused when gaps and partitions were included.