optimised detach() so it doesn't propagate a dirty state if it wasn't actually detached.