Added some simple error checking to backprop wrapper