fixed bug when preview is in new window