fix the bug: the randomize function cannot properly handle variables with prior