First, you should unregister in reverse order you registered your operators, keymaps, etc. Second, when registering keymaps you have to check keyconfigs are actually available (they are not in background mode).