handle modals correctly