added missing exception handling