improved error message for reference tags