if there is an error then dir it