Publishing components is detaching instances

When I publish components in my file, any instances whether they are nested in another component or not, are being detached. Why is this happening? Am I doing something wrong?