bug in handling finish()