fix bug when panels are hidden