changed getdb query code