Fixed bugs in converted glenz code