fixes to get_tsn to avoid broken results for some use cases