Remove this cast, find a different way to do this check. Logic shouldn't not be based on the family type.