Add a option to return null when the path is not valid.