Cast to connection type because it can't match the type