After much fiddling about ..
 now does global optimisation (over all elements of matrix / vector)
 still fails for _sm.m