Fix subindexing for maparray function

Close #5452