Fixes function serialization