Cast hasAttachEvent to boolean early