More behaved if/else and fixed two small bugs for temp var and else classcast