DB/SAI: fix runtime errors and some other stuff. see issue #9667