add sourcestamps for referential integrity

Fixes #3079.