Copied patch from tuna

Change-Id: I4691161e261c3eb911cd43fd59aaff98bde278df