moving appdb defined type to db.pp
fixing some problems