fix bug when submitting