added simple (insecure) sql-where query, fixed some things about rescan