fixed calculation of array position when sampleIndex is set in WindowBase#Appl...

...y method