Fix div by zero of #536