Improved file checks for reading config and writing profile