Fix null index update issue and add test