BUG: check wrong var when writing out gradient vectors
Merge pull request #189 from Chaircrusher/GTractResampleInPlaceBug

BUG: check wrong var when writing out gradient vectors