fix secondary query and make it dynamic if the requests fail