Fix profile.d script write