Fixes XLIB cast.

Tested and can be merged.