fix trying to calculate log(0)