work properly with streams
add process/"end" event