fixing bug with clicking submit button more than once