smarter uncurry function
fix a bug in factory method
    when an array is passed into a function produced by factory, the array is flattened