Handle user database initialization

This commit improves the robustness of user database access. The user database users.txt is no longer assumed to exist, and is now created on demand.
Merge branch 'fix-user-db-initialization' into devel