fixes #887
fix badly written condition