Fix X11 Segfault

To fix #645.