gradient check done (tested)