Fixed undefined index issue on view mode