Fixed error handling on unixy platforms.