Fix (i <= 1001) and BufferWidth & Height