fixed race condition in instance creation
fixed merge conflict with race condition fix