Avoid X11 threading errors; fixes #1

Thanks: http://stackoverflow.com/a/18690540/472927