Added test for UserApi + minor fixes