fix subgradient batch bug and add a test

Fixes pystruct/pystruct#110