fixed the bug spikes in the first position

the bug was that if you had a series like {1, 0, 0, 0, ... more zeroes ...}
you would always get a spike in the first position because the difference between
the first and the second element is non-zero while the rest of them are zeroes
guard against potential OOB array subscript
correct package name