Fix getattr invocation portability issue