Fixed memory corruption issues that caused hanging on scene load

This patch solves the issue: https://github.com/SlicerIGT/SlicerIGT/issues/8