Some small fixes

The code in api/annotation.py was technically correct, but caused
exceptions in a wsgi environment