Fixed NaNs and log() once more