Fixing bug in path check