Some code cleanup and fixed segmention fault in SoDATest.