Trying to fix NoneType