added code generation for storing variables
corrected some compilation errors