many fixes to get the thing working