fix #638 try to infer id of Document() if Object() is missing