fixed bug in the monotone case - hopefully ready to submit