Added exception handling for out-of-domain thetas