Fixes a logic error where a dictionary was replaced with a string.