fixed notifcationquery for new db structure