changed db query format