error trapping for inputs