database writing worked