Fixed bug with  generating window image