fixed bug in bi_read_var