fix log crash, add safety sync on db

- ruben