Fixing the submit logic