Added more tests and fixed bugs

I wrote more tests. It revealed some bugs in article caching that I fixed.

The most important bug was rebinding the nonlocal variable "lost_and_found" in a nested function that caused error "variable referenced before assignment".