handle missing directories and other errors a little better