Fix for __exit__ DB errors