add keep_window_bd function