Fixed bug in the alloy generator where wrong alloy code was generated

Also fixes testCase not passing