fixed queries, links, exception handling