added tests for user history view and fixed a bug