Fixed logic in prepare so that admin password is reset before checking for root

Change-Id: Ic853edb9d5125892824032941eeeb64419b600e5