Python: pickle fixes, added to test