fix bugs in window sliding