fix bug when sidebar count is nil