Resolved view instance scope by seetting to null globally and added condition. Need to wrap in function