Merge pull request #2151 from mfournier/check_capability-rewrite-fix