replaced strerror with strerror_r