changed exception handling