solving concurrent access to DOM parser issue