Fixed bug in python scripts