fix document constructor issue