Fix EZP-20640: Subtree limitation for the state/assign policy does not work.

Added improvements suggested in the pull request.