updated exception handling a bit