bad_pores should be trimmed at the very end of the function so that 'pname_transform' is calculated correctly.