Fixed segfault
Tidied up debug insertions