Moved setDocument after version setting