Fix ArrayIndexOutOfBoundsException when sending >2kB size packages.