fixed the resetting the inverse on matrix change