Fix sign error and derivative singularity in the origin