Fixed a bug with monotone pieces