added writeIDB()