fix windraw functin