Fix segfault when GC is on
(cherry picked from commit c4afe0acc2342b736f9e1b020e1e85c3b2a4d5b6)
Merge pull request #985 from sjinks/segfault-config-1.2.2

[1.2.2] [Regression] Fix segfault when GC is ON