cherry pick sg-id fix : 40d47a8e86 and b26fb5ec62

Change-Id: I42aa63b8954aa03b0ea50b697769e49e627d9d4f