adding typecheck for if-then-else and return statements