index calculation for lz4 and bugfixes