avoid silly division by zero errors
 mysql deletes; some reformatting