BUG: remove spurious max/min functions in optimize (ticket #1836)