Fix gradient checking; fix backpropagation