Correct factorial function.