Add failing test and fix error in empty or bad path

- When applying on bad or empty path read-installed throw an error about Object.keys
- This commits adds a failing test
- Fixed error