Fix bug inserting rows and columns and rename state variable.