fixed some small matlab and python extension bugs