fix bug:restrict types and NoneType error