bug correction WriteXobs, internal functions to own file