cached markup logic fixed for modals