Fix a couple methods for SQLAlchemy