database write works