A few changes for compatibility with the X11 build.

The Windows build is broken with this commit.