fixed select_query in database class