Fixed bug that an empty window context generates