some fixes / more refactoring

and set debug = yes by default