Added error handling for input path