move object instanciation in the try block