Really fix bugs 399 and 411

Change-Id: Ic9c0b2b3d2f687041d0f7710f76769c8a2a407ae
Signed-off-by: Lorand Jakab <lojakab@cisco.com>