handle possible error in chmod