Defensive programming needed on Mac + getattr -> hasattr