improved and()/or() handling per issue #1