fix NoneType error.