improve errors behaviour