Fixing null pointer exception when initializing the db writer.