Avoid mixing mapped and table keys

@AFoletti please test, I think it's ok now