Fixed replaceItem and replaceBlock crash