Use regex replace to make sure empty keys get replaced on key generation.