Reference validation (fix for issue #25)