Fix for the internal replace methods when replacing by object reference.

Signed-off-by: Jared Woolston <jwoolston@tenkiv.com>