Fix indent and whitespaces
Check if file exists before try to read it. Fixes #2764