dir check not working