getattr() will never return the correct value, using dict.get() instead