fixed a bug with finally