Really set maxindex correctly..