fixed small bugs in optimise funvs