fix window freezing and window initial placement