Fixed directory initializing code