added potential fix to detach check in leave frame