Fix issue with getElement() on null index return