simplified <if> handling ( and fixed several bugs, too )