Merge changes I6b6f7537,I18e5b72d

* changes:
  Fix a few style issues and remove LOG spam
  More error checks to avoid div by zero.