fix for a possible round by zero bug, also fixed rounding issue and formatting