Xenopsd backports from trunk