fixed issue #81 + namespace management in writing document