Fix selecting of errors

Fixes #747