fixed log(0) bug