fix incorrect access to errno