Resolved the bug of 5.0.2 i.e. TypeError: Layer must be a document node