better handling of log of 0