improve support for "if id1 and id2:" conditions