fix occasional attribute errors