Fixed Undefined Error for getNext