Fix random fails of unit tests

Change-Id: I18f2efd7a5a4055ab7ffbc900cc453f578922641
Fixes: bug #1223953
(cherry picked from commit 7cb4e91cac0bb1c71cde6f67ec3d83457dcf9042)