Add detach event support