Changed the way errors are handled