Fix sqlalchemy 0.8.x compatibility