changes the exceptions handling but has to improve