update next non-elem in the array range appropriately