Fix key processing on Windows #1662