Only displaying debug output in case there is a potential miscalculation
Fixing header error reporting

Thanks to Lukas Prokop for reporting this