Fix initialization of detached images