fix bug for missing where clause