(#153) - improved error handling