bugfix when using -1 for windowlength