upgrade document metadata handling, with dynamic wait