fix selection box jumping at edges