fixing bug with __getattr__ in python 3