add some debug and fix indents