Permissions fixed when creating file. Duplicated commands fixed