fix signal handling in non-threaded (thanks to Paulo Moura).
fix bb usage of DB.
fix bb usage of DB.