Improve profile.d script