fixed document loading bug