bug fixes from changeover to $where array