fixed exception global name 'attrs' is not defined