Changed average to 1/n instead of 1/n-1 to avoid divide by zero.
Resolved type mismatch in draw2d routine "thickness" was not referring to its "val" item.