fixing the boolean rewrite