bugfix, range off by 1 error on replacing objects