update local db sql, fixed some issue with update