Fixed some errors
Merge pull request #160 from izaid/fix

Some fixes for Python, but some failing tests remain.