readded zerodiv check, default total to 1