Fix bug for auto-staging, auto-releasing and auto-undo

Change-Id: Ia54d30f82e0f606677861faf57014191bbbf4adb