added exception control