modified factorial to include 0