fixed bug in contextwindow