more resilient sidebar code