Fixed bug in linear partition algorithm. Fixes #3