fix bugs and add test for negated conditions for #74