some validation, removed stream context