Verified correctness of weight updates and fixed minor issues with that.