undoing part of previous change to fix db write problem