fix attachment detection