nonetype bug fix