Issue#365 global err setup

Fixes #365