fixed some bugs in input/output db into files