fixed open_flag check