Fix removing button target when dialog gets closed.