bug fixed in prepare_panel