Hacky patches for python support