fix the sql statement in updateDevice