Fixed bug which cleared selection on window resize