minor optimisations
fix test
test square loss