Bug fix in py