Code fix for certain k values

fixed array out of bounds error on the video pixels