Fixed exception handling, and switch to tuple.equals