Added work-around for problems with old sqlalchemy versions.