Reversed change that caused segfault in issue #5126

See issue #5126

I've verified that reverting this change fixes the segfault.