fix None.type error