improve errors handler (close #9)