fix Document creation and getRootElement() behaviour