Fix some namespaces
Move debug function into init script