added some sanity checks in views.submit