try defensive code for error NoneType has no attr slug