Fix logging if data undefined