Fix bugs in Factory and FactoryGirl provider