Added checks for attachment operations.