before submit works