ensure attributes are preserved during variable subsetting