waf: many fixes