fix for factorial method