implemented autocomlete with error handling