Use appropriate class in getattr call