Fix event registration of shown/hidden in modals

This fixes issues with IE.