fixed bugs in sidebar handling