Bug corrected in creating sliding window