maybe this should be msg == null ?