modified db_query parameter handling to be compatible to drupal