update toFunction