fix for the case when strdup() fails