The last key path component may resolve to a non-dictionary, so it shouldn't be tested then.