Fix externalRepresentation()

The externalRepresentation method wasn't correct. A nested keypath wasn't treated as expected. A new test was included to ensure this behavior.