fixed db manager thread. it was being started after it has been terminated which is illegal. fixed the dbmanager implementationa and cleaned the code a little bit to make it better