avoid out of bounds in sidebar