NoneType fix