misc changes to restore the actual where clause