Added tests for ReplHistory. Made ReplHistory more robust