finally fixed keyboard emulation for os x