Fix #543 preview window problem