fixed a edge bug for negative window sample