added dir check