Fixed file scanning to create a new file if non exists.