added check for method getDefaultAttributes exists. thx to Flyingmana