updated to conform with the new api of swig