Added test stack traces for debugging. Fixes for windows compiling in the wrong place.