implement RB put method