fix factorial method for edge cases 0 and 1