log should go inside the if condition as well