reimplemented exception handling