replace eval with multiple getattr calls