Fix error in serializing optional arguments

When defining a function with optional parameters, I would get a *TypeError: cannot serialize 0 (type int)* error. This fixes the problem.