fix a silly NoneType error by checking the wrong thing