db write fix