fix a bug (cond for referenced table)