Massive bugfixes and support for userland threads from executable images