Dialog added to DOM at a better time