fix some bugs in Panel