Fixed missing null assignment after detach().