db: add empty string test for "text" type
simplify paths before using as hash keys