Fix logic bug in db_single_query, also store normalized urls in the DB.