move tmp variable in try block