Better checking before using `in` operator on

Fixes #18