(0.9.37-unstable) Backport over changes to gte.cpp