Added an  if null for the submit value to avaoid errors