Revert "merged branch povilas/issue_6101 (PR #6708)"

This reverts commit b2bcbbbd19efdb6e4f2133dfbdf162c9bb30a214, reversing
changes made to c5fcf0d0cc6a3353ec13e2141411e082693db2d5.