Remove bug in __contains__ function