added tests for query and matrices