Improved logging to debug math issue