changes in templates to get expected behavior in java as well as python