fix compilation issues on Linux. what remains are some pretty bizarre performance issues that I experienced today while testing. These don't appear on Windows.