fixed updating empty row in SQL