This actually replaces two ad-hoc fixes with a more unified solution (with comment for posterity). Change-Id: I62f57cb489c900f68a0c7aeb3e20e4715c0e2661 Signed-off-by: Radosław Piliszek <radoslaw.piliszek@gmail.com>