fix unsubscribe function