Fixed log undefined issue