Galois: fixed the bug causing a segfault.
C++ code should now work. Untested with actual results.