createhosts - add some error checking