Fixes in print format and db_query