take into account prefix can be empty

Signed-off-by: Denis Zalevskiy <denis.zalevskiy@jolla.com>