Changed path detection by using os.path.join instead of string concatenation