Return a 404 if a study is not found

A test was added and a small bug fixed in opentreetesting.py as well.