fixing modal loop