Fixed bug in factorials