node.js function serialization/deserialization