fix modal function