implement xmopen
add a test for xmopen