Updated index, fixed bug when input content is empty