Insert function changes

Fixed insert function as per Max's request. Add isNotTable for table
check.