Added error handling for cases where path is passed.