exception handling fixed