Fix #1 by adding gethostbyname call in begin() method.