functions, but weird double bug on bad input