Add functions to serialize objects with functions