make more defensive, only filter if there is data