fixed subsetting of rows, corrected filtering for adequate depth