Fixed caching and sqlalchemy session works fine now