Partial fix (break existing tests)
Fix regressions
Factor tests
Merge pull request #556 from OkayX6/fix-record-stub-gen-smart-tag-bug

Fix record stub gen smart tag bug