fixed the scipy.optimize.minimize() bug - start converting evertyhing to that, it's more elegant