Fix some warnings, improve debug message