Check that keys are strings, and clarified an except statement.