fix modal logic