fixed calculation to factorial