fix bugs and add a portion of resolve address.