some minor modifications to the python script