Final fix for where clause