Added NoneType check for tests