fixed a bug that the previous modal class was not removed from the modal element.