Restore checking from 7db0352, reverted in dbe08d5