curry2 and curry3 in place