bug fix on removeById() and replaceById()