minor fixes and debug comments