Perhaps change to:

```
keyPath = keyPath && topKeyPath ? topKeyPath + '.' + key : key;
```