Fixed issue with empty stream + added test