Made checks for NoneType