implement tag validation (fixes #28)