Fix address resolution bugs, add debug info