Changes to make code compatible to new db.