prevented errors from bad input