Fix crash, and some debugging code