More fixes for SQLAlchemy