fix for attachment class

fix for attachment class. When dev error turned on it was trowing
errors.