hasattr check was a wrong idea