select_db() and other fixes and updates.

Signed-off-by: Norv <a.w.norv@gmail.com>