Fix #542

The bug was in the conditions used in the find function.