Fix index bug in record viewer