fix config parsing: don't crash on truncated file or extra data at the end