A few bug fixes & better debug messages.