Added a rather ugly workaround for a SWIG 3 bug