Partial fixes to the shitshow caused by pthreads and type declarations.