fixing the problem with Savitzky Golay