improved sidebar handling