fixed xpwx C++ function