Added check for profile directory existance