fix conditional statement for tags and add filter