fixed null check in getAttributes