minor fixes; better debug output