fixed some try/catch code