fix problem where dialog DOM not removed properly on cancel/save