Revert "remove unnecessary check"

This reverts commit d0eb264651984daa4da4e76b04e90ed41102cb08.