Fixes incorrect key mappings and incorrect rest parsing
fixed conflicts
added tests by Dy