fix duplicate error message; add functions to rb tree