Formation of gas giant planets: core accretion models with fragmentation and planetary envelope