Improves leaveActivity API method.