fixed edge case where initializing a modal in different order then when showing causes incorrect z-indexes