Fixed detach and removed warnings