added checks for table and update if exist