Fixed problem for optimise.py