avoid comparing sentence index to None