Fix references to basestring in generated code