add small value to log to prevent log(0)