bug fix for auto-generated python code