Fix test script: only accept exact number of calls to query. Fix code regarding delete.