fixed bad where clause