Fix segfaults in conversion due to lack of initialization
Add debugging machinery