modify condition check for table exist