fixing another NoneType error