add check for Nonetype