Bug error with if/else log management