An aqueous polymer dispersion comprising: A) a polymer synthesized from monomers comprising, a) 1.0 to 90% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one alkyl (meth)acrylate; b) 0.1 to 10% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one ethylenically unsaturated acid or vinyl monomer with latent ionic groups; c) 0.5 to 5.0% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one monoethylenically unsaturated monomer having at least one keto or aldehyde group; d) 1.0 to 90% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one vinyl ester of saturated aliphatic monocarboxylic acid in which the carboxyl groups are attached to tertiary and/or quaternary carbon atoms; e) 0 to 20% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one vinyl aromatics; f) 0 to 20% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one hydroxyalkyl (meth)acrylate, and B) at least one compound which comprises at least two functional groups reactive to the keto or aldehyde group, wherein the Tg of polymer A) is from -13 to 20 °C, as determined by Differential Scanning Calorimetry. A) a polymer synthesized from monomers comprising, a) 1.0 to 90% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one alkyl (meth)acrylate; b) 0.1 to 10% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one ethylenically unsaturated acid or vinyl monomer with latent ionic groups; c) 0.5 to 5.0% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one monoethylenically unsaturated monomer having at least one keto or aldehyde group; d) 1.0 to 90% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one vinyl ester of saturated aliphatic monocarboxylic acid in which the carboxyl groups are attached to tertiary and/or quaternary carbon atoms; e) 0 to 20% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one vinyl aromatics; f) 0 to 20% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one hydroxyalkyl (meth)acrylate, and a) 1.0 to 90% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one alkyl (meth)acrylate; b) 0.1 to 10% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one ethylenically unsaturated acid or vinyl monomer with latent ionic groups; c) 0.5 to 5.0% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one monoethylenically unsaturated monomer having at least one keto or aldehyde group; d) 1.0 to 90% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one vinyl ester of saturated aliphatic monocarboxylic acid in which the carboxyl groups are attached to tertiary and/or quaternary carbon atoms; e) 0 to 20% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one vinyl aromatics; f) 0 to 20% by weight, based on the total amount of monomers for the synthesis of polymer A), of at least one hydroxyalkyl (meth)acrylate, and B) at least one compound which comprises at least two functional groups reactive to the keto or aldehyde group,