fixing modal not reverting back to previous state