Changes to adjust better to the old SQL schemas.