fixed bugs and test in intermediateCode