added debug print of sql query.