Fixing a bug where secondary key is being added twice.