1. small fix in detection using window