fix the "return NoneType" bug