Fixed module-thread initial bindings
Various fixes to make things compile