Added sanity checks to tdb_record_add