Fixed bug with null attachment