runtime cast correction, threads.h include path fix, and removal of leftover debug logging