Adds error treatment