corrected use of 1-offset array