added a finally block