Long gamma-ray bursts (LGRBs) are associated with the death of massive stars, they therefore should be a powerful tool for tracing the cosmic star formation rate (SFR) in principle. However, numerous studies indicate that the LGRB rate does not purely trace the SFR, remaining an open question in this field. Actually, the intrinsic formation rate and luminosity function of LGRBs cannot be derived directly using the observed GRB redshift samples since they are affected by observational bias. In this talk, I will introduce a simple method of estimating the instrumental trigger probability and the redshift measurement probability to correct the bias caused by observational effects. In addition, the stellar mass/metallicity preference of LGRB host galaxies is also potentially responsible for the discrepancy between the LGRB rate and the SFR. I will also talk about a correction to this preference using the stellar mass function of LGRB host galaxies.