updated sidebar state handling