PLD: indentation and helper to check file validity
PLD: test that invalid file is caught, #563