adding hasattr check for major version number