Fixed "None" result from python.
Improved test cases.