Fixed bug that causes optimizer to crash when _f return mpmath datatype