Switch to a more reliable testing method - fixes 806

Fixes #806.