We reconsider the existing kernel estimators for a copula function, as proposed in Gijbels and Mielniczuk [Comm. Statist. Theory Methods 19 (1990) 445–464], Fermanian, Radulovič and Wegkamp [Bernoulli 10 (2004) 847–860] and Chen and Huang [Canad. J. Statist. 35 (2007) 265–282]. All of these estimators have as a drawback that they can suffer from a corner bias problem. A way to deal with this is to impose rather stringent conditions on the copula, outruling as such many classical families of copulas. In this paper, we propose improved estimators that take care of the typical corner bias problem. For Gijbels and Mielniczuk [Comm. Statist. Theory Methods 19 (1990) 445–464] and Chen and Huang [Canad. J. Statist. 35 (2007) 265–282], the improvement involves shrinking the bandwidth with an appropriate functional factor; for Fermanian, Radulovič and Wegkamp [Bernoulli 10 (2004) 847–860], this is done by using a transformation. The theoretical contribution of the paper is a weak convergence result for the three improved estimators under conditions that are met for most copula families. We also discuss the choice of bandwidth parameters, theoretically and practically, and illustrate the finite-sample behaviour of the estimators in a simulation study. The improved estimators are applied to goodness-of-fit testing for copulas.