Solution to deal with exceptions