Selecting background galaxies in weak-lensing analysis of galaxy clusters