Fix content type generation

Fix #2292
Fix #2006