Fix some bugs and add user management stub