Fixing sync bug with DB