fixing bug in block_flag