Attempt to fix modal display logic.