Fix refid namespace problems