debug 12/13

dom0 seems to work(?)

fix some bugs, add debugging messages.