added exception management