added gradient check
added gradient check