bugfix: avoid getting attribute twice!! hasattr() does getattr()!!