Window code fixes