Removed check for getAttribute in attr, seems to work without it