bug fixes for Xcompiling