MEDIUM / fix cast exceptions, update shape specification factory for
rectangular octogon and complex curve, work in progress