added hopefully better debug code