Kofax to buy Nuance's imaging division for $400M in cash