Fix bug DNN-4840: merge changes from Jira.