Fixed issue with taking the log of 0