fixed an issue with negative logarithms