Fix record stub gen smart tag bug

Fixes #538.