Bugfix for the context manager.

Serves me right for not testing it properly.