correct errors when in wrong working directory
improve IPv4 error handling