Fixed nested if/else in internal correlation.