Buggy version: error on applying template to functions in join_table