fixing bug in window func