improve debug logging and fix spelling