Add error stream.

Repaired scores bug.
Replaced dynamic_cast by static_cast - where it is possible.