Fix up "division by zero" causing a stack overflow. Closes #19.
Also fixes some unexpected window tabbing in docks.