Fix NPE in tests by adding instanceof check for cluster members