fix output for each branch of logic