Problem fixed by adding GC_INIT(); before calling GC_MALLOC(len), fixes #1