sys: osx: fix keymap
math: mod and safe normalize