Improved checking

Fixes #2539 ?