some code changes in handling contents