Fixing bug where sometimes only white empty window would display