fixed all the errors, mostly with try/catch's