Improved permission check block.