Small fixes

Fixes in calcs and debug output