Fixed more errors with the query and db_connect