fix data query issues