Fixed bug in ifelse IR