where clause code generation bug fix