Bug fixing in get_ir()