modified getAttribute method