added replace logic to viewManager