Add error check for paths