Fix some X errors that show up when debug messages are enabled.