Fixes logging with perror()